﻿using System.Collections.Generic;

namespace xxpl1.Connection
{
    public class ConnectionManager
    {
        private static readonly Dictionary<string, ConnectioPool> connectionPools = new Dictionary<string, ConnectioPool>();

        public static ConnectioPool FindConnectioPool(string server)
        {
            if (!connectionPools.ContainsKey(server))
            {
                lock (connectionPools)
                {
                    if (!connectionPools.ContainsKey(server))
                    {
                        connectionPools.Add(server, new ConnectioPool(server));
                    }
                }
            }
            return connectionPools[server];
        }
    }
}
